home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / art&graf.ix / art-0039 / source / myfilese.def < prev    next >
Text File  |  1997-04-16  |  3KB  |  78 lines

  1. DEFINITION MODULE MyFileSelector;
  2.  
  3. (*
  4.    These are routines to make it easier to get a filename from the user.  
  5.  
  6.     a) File Control.
  7.        These are routines that use the standard GEM file selector dialogue.
  8.        the information that is required is :-
  9.          a path name ( will get current pathname if required )
  10.          a file selection mask
  11.  
  12.        the information returned is :-
  13.          the complete selected pathname
  14.          a flag to indicate whether user OK'ed or 'CANCEL'led selection.
  15.       
  16.     b) UpperCaseString 
  17.  
  18.     c) Parse a filename into components
  19.  *)
  20.  
  21. FROM Strings IMPORT (* type *) String;
  22.  
  23.  
  24. TYPE
  25.      Pathname = ARRAY [ 0 .. 64 ] OF CHAR;
  26.  
  27.  
  28. PROCEDURE UpperCaseString ( VAR str : ARRAY OF CHAR );
  29.  
  30.  
  31. (*-----------------------------------------------------------------------*)
  32. (* Given a complete pathname then split it up into its constituents.     *)
  33. (*    a) Drive Letter                                                    *)
  34. (*    b) Path                                                            *)
  35. (*    c) filename                                                        *)
  36. (*    d) extension                                                       *)
  37. (*-----------------------------------------------------------------------*)
  38. PROCEDURE ParseFilePath( Pathname : ARRAY OF CHAR;
  39.                  VAR Drive     : ARRAY OF CHAR;
  40.                          VAR Directory : ARRAY OF CHAR;
  41.                          VAR Filename  : ARRAY OF CHAR;
  42.                          VAR Extension : ARRAY OF CHAR );
  43.  
  44.  
  45. PROCEDURE GetFilename (     DefaultExtension  : ARRAY OF CHAR; (* input  *)
  46.                         VAR DefaultPath       : ARRAY OF CHAR; (* i/o    *)
  47.                         VAR SelectedFilename  : ARRAY OF CHAR; (* i/o    *)
  48.                         VAR CompleteFilename  : ARRAY OF CHAR  (* output *)
  49.                       ) : BOOLEAN ;
  50.   (* All input strings must be null terminated.
  51.  
  52.      Notes on what this function does and how it works.
  53.       The function is to get a file pathname from a user suitable for use
  54.      by GEMDOS or the procedures in 'Streams'. You are allowed to specify a
  55.      default extension and/or a default filename to be shown. 
  56.  
  57.       If any of the inputs are null then assumptions are made.
  58.        1) If the DefaultPath is null then the default disk & path is used.
  59.           OR the last path selected.
  60.  
  61.        2) if the DefaultExtension is null then the mask '*.*' is added
  62.          to the default Path otherwise '*.ext' is used.
  63.  
  64.        3) if the selected filename is null then no filename is shown on the
  65.          screen otherwise the file name is shown.
  66.  
  67.       What is returned?
  68.        1) The selected file name is returned.
  69.        2) The path the user used is returned in DefaultPath.
  70.        3) The complete drive, path and filename is returned in
  71.          CompleteFilename.
  72.        4) Whether the OK button is selected AND a filename has been selected
  73.          is returned as a flag.
  74.  
  75. *)
  76.  
  77. END MyFileSelector.